<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexRelationTypeInTaskRelation extends AbstractMigration
{
    public function up()
    {
        $this->table('task_relation')
            ->addColumn('relation_type', 'char', ['default' => '', 'limit' => 255, 'comment' => '关联类型'])
            ->addIndex(['relation_type'], ['name' => 'idx_relation_type', 'type' => 'normal'])
            ->save();
    }

    public function down()
    {
        $this->table('task_relation')
            ->removeColumn('relation_type')
            ->removeIndexByName('idx_relation_type')
            ->save();
    }
}
